<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Taskflow Handbook</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="https://taskflow.github.io/">Taskflow</a>
   &#160;<span id="projectnumber">3.0.0-Master-Branch</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('install.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Building and Installing </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This page describes how to set up Taskflow in your project. We will also go through the building process of unit tests and examples.</p>
<h1><a class="anchor" id="BAISupportedCompilers"></a>
Supported Compilers</h1>
<p>To use Taskflow, you only need a compiler that supports C++17:</p>
<ul>
<li>GNU C++ Compiler at least v7.0 with -std=c++17 </li>
<li>Clang C++ Compiler at least v6.0 with -std=c++17 </li>
<li>Microsoft Visual Studio at least v15.7 (MSVC++ 19.14) </li>
<li>AppleClang Xode Version at least v8 </li>
<li>Nvidia CUDA Toolkit and Compiler (nvcc) at least v11.0 with -std=c++17</li>
</ul>
<p>Taskflow works on Linux, Windows, and Mac OS X.</p>
<h1><a class="anchor" id="BAIIntegrateTaskflowToYourProject"></a>
Integrate Taskflow to Your Project</h1>
<p>Taskflow is <em>header-only</em> and there is no need for installation. Simply download the source and copy the headers under the directory <code>taskflow/</code> to your project.</p>
<div class="fragment"><div class="line">~$ git clone https://github.com/taskflow/taskflow.git</div><div class="line">~$ cd taskflow/</div><div class="line">~$ cp -r taskflow myproject/include/</div></div><!-- fragment --><p>Taskflow is written in C++17 and is built on top of C++ standardized threading libraries to improve portability. To compile a Taskflow program, say <code>simple.cpp</code>, you need to tell the compiler where to find the Taskflow header files and link it through the system thread library (usually <a href="http://man7.org/linux/man-pages/man7/pthreads.7.html">POSIX threads</a> in Linux-like systems). Take gcc for an example:</p>
<div class="fragment"><div class="line">~$ g++ simple.cpp -std=c++17 -I myproject/include/ -O2 -pthread -o simple</div></div><!-- fragment --><h1><a class="anchor" id="BAIBuildExamplesAndUnitTests"></a>
Build Examples and Unit Tests</h1>
<p>Taskflow uses CMake to build examples and unit tests. We recommend using out-of-source build.</p>
<div class="fragment"><div class="line">~$ cd path/to/taskflow</div><div class="line">~$ mkdir build</div><div class="line">~$ cd build</div><div class="line">~$ cmake ../</div><div class="line">~$ make                         # compile all examples and unittests</div><div class="line">~$ make test</div><div class="line"></div><div class="line">Running tests...</div><div class="line">/usr/bin/ctest --force-new-ctest-process</div><div class="line">Test project /home/tsung-wei/Code/taskflow/build</div><div class="line">        Start   1: passive_vector</div><div class="line">  1/254 Test   #1: passive_vector ...................   Passed    0.04 sec</div><div class="line">        Start   2: function_traits</div><div class="line">  2/254 Test   #2: function_traits ..................   Passed    0.00 sec</div><div class="line">        Start   3: object_pool.sequential</div><div class="line">  3/254 Test   #3: object_pool.sequential ...........   Passed    0.10 sec</div><div class="line">...</div><div class="line"></div><div class="line">100% tests passed, 0 tests failed out of 254</div><div class="line"></div><div class="line">Total Test time (real) =  29.67 sec</div></div><!-- fragment --><p>When the building completes, you can find the executables for examples and tests under the two folders, <code>examples/</code> and <code>unittests/</code>.</p>
<h1><a class="anchor" id="BAIConfigureCMakeOptions"></a>
Configure CMake Options</h1>
<p>You can list a set of available options in the cmake.</p>
<div class="fragment"><div class="line">~$ cmake -LA</div><div class="line">...</div><div class="line">TF_BUILD_EXAMPLES:BOOL=ON       # by default, we compile examples</div><div class="line">TF_BUILD_TESTS:BOOL=ON          # by default, we compile tests</div><div class="line">TF_BUILD_BENCHMARKS:BOOL=OFF    # by default, we don&#39;t compile benchmarks </div><div class="line">TF_BUILD_CUDA:BOOL=OFF          # by default, we don&#39;t compile CUDA code</div><div class="line">...</div><div class="line">... more options</div></div><!-- fragment --><p>Currently, our CMake script supports the following options:</p>
<div align="center"> <table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadCenter">CMake Option  </th><th class="markdownTableHeadCenter">Default  </th><th class="markdownTableHeadCenter">Usage   </th></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyCenter">TF_BUILD_EXAMPLES  </td><td class="markdownTableBodyCenter">ON  </td><td class="markdownTableBodyCenter">enable/disable building examples   </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyCenter">TF_BUILD_TESTS  </td><td class="markdownTableBodyCenter">ON  </td><td class="markdownTableBodyCenter">enable/disable building unit tests   </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyCenter">TF_BUILD_BENCHMARKS  </td><td class="markdownTableBodyCenter">OFF  </td><td class="markdownTableBodyCenter">enable/disable building benchmarks   </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyCenter">TF_BUILD_CUDA  </td><td class="markdownTableBodyCenter">OFF  </td><td class="markdownTableBodyCenter">enable/disable building CUDA code   </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyCenter">TF_BUILD_SYCL  </td><td class="markdownTableBodyCenter">OFF  </td><td class="markdownTableBodyCenter">enable/disable building SYCL code   </td></tr>
</table>
</div><p>To enable or disable a specific option, use <code>-D</code> in the CMake build. For example:</p>
<div class="fragment"><div class="line">~$ cmake ../ -DTF_BUILD_EXAMPLES=OFF</div></div><!-- fragment --><p>The above command turns off building Taskflow examples.</p>
<h1><a class="anchor" id="BAIBuildCUDACode"></a>
Build CUDA Code</h1>
<p>To build CUDA code, including unit tests and examples, define the CMake option <code>TF_BUILD_CUDA</code> to <code>ON</code> as follows:</p>
<div class="fragment"><div class="line">~$ cmake ../ -DTF_BUILD_CUDA=ON</div><div class="line">~$ make</div></div><!-- fragment --><p>To compile a Taskflow program with CUDA (e.g., <a class="el" href="classtf_1_1cudaFlow.html" title="class for building a CUDA task dependency graph ">tf::cudaFlow</a>), use <a href="https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html">nvcc</a> with C++17 enabled as follows:</p>
<div class="fragment"><div class="line">~$ nvcc my_taskflow_cuda_program.cu -std=c++17 -o my_taskflow_cuda_program</div></div><!-- fragment --><p>Taskflow's tasking interface for CUDA GPU programming is built on top of <a href="https://developer.nvidia.com/blog/cuda-graphs/">CUDA Graph</a>, which allows work to be efficiently defined as graphs rather than single operations.</p>
<h1><a class="anchor" id="BAIBuildSYCLCode"></a>
Build SYCL Code</h1>
<p>TBD </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
